﻿using System;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.IO;
using System.Web;
using Ths.Components.Common;
using Ths.Components.Excel;
using Wuqi.Webdiyer;

namespace SafetyRecordData.Data.DAL
{
    public class DASearch : DBBase
    {
        public DataTable GetHurtMessage(string staffid,string starttime,string endtime)
        {
            string strSql = "select * from HurtDistress WHERE Workernumber='" + staffid + "' and isnull(status,'0')='55' ";
            if (starttime != "")
            {
                strSql += " and HappenTime>='" + starttime + " 00:00:00'";
            }
            if (starttime != "")
            {
                strSql += " and HappenTime<='" + endtime + " 23:59:59'";
            }
            return base.DBFactory.GetDataTable(strSql);
        }

        public DataTable GetSanWeiMessage(string staffid, string starttime, string endtime)
        {
            string strSql = "select * from SanWeiMessage WHERE Workernumber='" + staffid + "'  and isnull(status,'0')='55' ";
            if (starttime != "")
            {
                strSql += " and HappenTime>='" + starttime + " 00:00:00'";
            }
            if (starttime != "")
            {
                strSql += " and HappenTime<='" + endtime + " 23:59:59'";
            }
            return base.DBFactory.GetDataTable(strSql);
        }

        public DataTable GetPraiseMessage(string staffid, string starttime, string endtime)
        {
            string strSql = "select * from SafePraise WHERE Workernumber='" + staffid + "' and isnull(status,'0')='55' ";
            if (starttime != "")
            {
                strSql += " and PraiseTime>='" + starttime + " 00:00:00'";
            }
            if (starttime != "")
            {
                strSql += " and PraiseTime<='" + endtime + " 23:59:59'";
            }
            return base.DBFactory.GetDataTable(strSql);
        }

        public DataTable GetPublishMessage(string staffid, string starttime, string endtime)
        {
            string strSql = "select * from SafePunish WHERE Workernumber='" + staffid + "' and isnull(status,'0')='55' ";
            if (starttime != "")
            {
                strSql += " and PunishTime>='" + starttime + " 00:00:00'";
            }
            if (starttime != "")
            {
                strSql += " and PunishTime<='" + endtime + " 23:59:59'";
            }
            return base.DBFactory.GetDataTable(strSql);
        }
    }
}
